import java.util.Scanner;

public class HanoiTower {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        System.out.println("请输入阶数：");
        int n = scan.nextInt();
        hanoiTower(n, 1, 2, 3);
    }

    public static void hanoiTower(int n, int a, int b, int c) {
        if (n == 1) {
            System.out.println(a + "->" + c);
            return;
        }
        hanoiTower(n - 1, a, c, b);
        System.out.println(a + "->" + c);
        hanoiTower(n - 1, b, a, c);
        return;
    }
}
